import Mock from 'mockjs'
const Random = Mock.Random
class Result {
  data: any
  code: number
  msg: string
  constructor(data = {}, code = 200, msg = '成功') {
    this.data = data
    this.code = code
    this.msg = msg
  }
}
Mock.mock('/login', 'post', () => {
  const data = {
    token: '123',
    name: '李四',
  }
  return new Result(data)
})
Mock.mock('/articleList', 'post', () => {
  const data = Mock.mock({
    'data|200': [
      {
        'id|+1': 1,
        name: '@ctitle',
        time: '@time',
      },
    ],
    total: 200,
  })
  return new Result(data)
})
Mock.mock('/list', 'post', () => {
  const data = Mock.mock({
    'data|200': [
      {
        'id|+1': 1,
        name: '@ctitle',
        time: '@time',
      },
    ],
    total: 200,
  })
  return new Result(data)
})
